home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 3
/
Gold Medal Software - Volume 3 (Gold Medal) (1994).iso
/
prog
/
cenvi29.arj
/
PATHDEL.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-03-08
|
1KB
|
48 lines
@echo off
REM ********************************************************************
REM *** PathDel.cmd - delete a directory from the current path if it ***
REM *** ver.1 is in the current path ***
REM ********************************************************************
if "%1"=="" GOTO SHOW_HOW
if not "%2"=="" GOTO SHOW_HOW
call CEnviSet %0.cmd %1
GOTO FINI
:SHOW_HOW
ECHO PathDel.cmd - Delete a directory from the PATH if it's there
ECHO USAGE: PathDel DirSpec
GOTO FINI
GOTO CENVI_EXIT
main(argc,argv)
{
OldDir = argv[1]
if NULL == (Position = FindDirInPath(OldDir))
printf("The Directory \"%s\" is not in PATH.\n",OldDir)
else {
// copy from Path beyond this dir
strcpy(Position,Position+strlen(OldDir))
// if there is a semi-colon at this position, then copy from beyond that too
if (Position[0] == ';')
strcpy(Position,Position+1)
}
}
FindDirInPath(Dir) // search through path for this Dir, return pointer if found
// and return NULL if not found
{
len = strlen(Dir)
p = PATH
do {
if ( 0 == strnicmp(p,Dir,len) && (p[len]==0 || p[len]==';') )
return(p)
p = strchr(p,';')
} while( p++ != NULL )
return(NULL)
}
:CENVI_EXIT
:FINI